package main;

import java.io.ObjectInputStream.GetField;
import java.util.ArrayList;
import java.util.Vector;

import javax.swing.JFrame;

import prefuse.Constants;
import prefuse.Display;
import prefuse.Visualization;
import prefuse.action.ActionList;
import prefuse.action.RepaintAction;
import prefuse.action.assignment.ColorAction;
import prefuse.action.assignment.DataColorAction;
import prefuse.action.layout.graph.ForceDirectedLayout;
import prefuse.activity.Activity;
import prefuse.controls.DragControl;
import prefuse.controls.PanControl;
import prefuse.controls.ZoomControl;
import prefuse.data.Graph;
import prefuse.data.Node;
import prefuse.data.io.DataIOException;
import prefuse.data.io.GraphMLReader;
import prefuse.render.DefaultRendererFactory;
import prefuse.render.LabelRenderer;
import prefuse.util.ColorLib;
import prefuse.visual.VisualItem;

import Tools.FragmentInterface;
import Tools.ProcessView;
import XML.FragmentXML;
import XML.XMLParser;
import XML.XMLProcessGenerator;

public class Main {

public final static boolean lowPerf = false;
	
	public final static String finalElement ="Application";	//final element, determine that a process is complete

	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		/**/
		//Debug.debug();
		
		
		Vector<FragmentXML> vectorFragments =XMLParser.parser("src/ProcessTest.xml");
		
		ArrayList<FragmentInterface> fgts=new ArrayList<FragmentInterface>();
		fgts.add(new FragmentInterface(vectorFragments.get(0).getName()));
		fgts.add(new FragmentInterface(vectorFragments.get(1).getName()));
		fgts.add(new FragmentInterface(vectorFragments.get(2).getName()));
		
		fgts.get(0).addIdTarget("1");
		fgts.get(1).addIdTarget("2");
		
		XMLProcessGenerator.writeProcess(fgts);
		
		
		 String path=new String("src/processGen.xml");
		 ProcessView p= new ProcessView(path);
		 
		 try{ 
			 Thread.sleep(6000); 
			 }catch(InterruptedException e){ 
			 System.out.println(e.getMessage()); 
			} 
		

//		System.out.println(" fin attente ajout lien : "+ p.getCurrentGraph().getNode(1)+" "+p.getCurrentGraph().getNode(2));
//		p.removeLink(p.getCurrentGraph().getNode(1),p.getCurrentGraph().getNode(2));
//		p.addLink(p.getCurrentGraph().getNode(1),p.getCurrentGraph().getNode(2));
//		System.out.println(" suppression noeud ");
	        
	        
	       

	}
	
}
